﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Lib.Data;
using Lib.Utils;

namespace SysObj
{
    public class Price_System : IDisposable
    {
        DataLayer db;

        DateTime m_Ngay = DateTime.Now;
        int m_IdBan = 0;
        int m_IdHangHoa = 0;

        public void Dispose()
        {
            db.Dispose();
            GC.Collect();
        }

        public Price_System(DateTime Ngay, int IdBan, int IdHangHoa)
        {
            db = new DataLayer();
            m_Ngay = Cvert.ToShortDate(Ngay);
            m_IdBan = IdBan;
            m_IdHangHoa = IdHangHoa;
        }

        public decimal GetSalePrice()
        {
            return Cvert.ToDecimal(db.ExecScalar("Sp_PriceSystem", "Command,IdBan,IdHangHoa,Ngay", "GetSalePrice", m_IdBan, m_IdHangHoa, m_Ngay), 0);
        }
    }
}
